import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'controller.dart';
import 'next_page.dart';

class StateDependencyPutFindView extends StatelessWidget {
   StateDependencyPutFindView({super.key});
  
  final controller = Get.put<CountController>(CountController());
  
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Dependency"),
      ),
      body: Center(
        child: Column(
          children: [
            GetX<CountController>(
              init: controller,
              initState: (_){},
              builder: (_){
                return Text("value -> ${_.count}");
              },
            ),
            const Divider(),
            ElevatedButton(
                onPressed: (){
                  controller.add();
                },
                child: const Text("add")
            ),
            ElevatedButton(
                onPressed: (){
                  Get.to(NextPageView());
                },
                child: const Text("next page")
            )
          ],
        ),
      ),
    );
  }
}
